package com.mk.rocket;

import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;

import java.nio.charset.StandardCharsets;
import java.util.List;

/**
 * @Author makai
 * @Description: TODO
 * @Date 2024/1/31 20:56
 */
public class ConsumerListener implements MessageListenerConcurrently {
    @Override
    public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
        System.out.println("c2收到消息:"+new String(msgs.get(0).getBody(), StandardCharsets.UTF_8));
        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
    }
}
